<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<meta charset="utf-8">
		<title>首页</title>
		<#include "./head.html">
		<!-- <link href="/static/bootstrap-4.1.2/dist/css/bootstrap.min.css" rel="stylesheet"> -->
		<style type="text/css">
			.smart-header {
				height:30px; 
				position:relative; 
				z-index:0; overflow:hidden;
				/*background-color: #5fa2dd*/;
			}
		</style>
		<script>
			$(function(){
				$('#tabs').tabs({
			    	fit: true,
			        border:false,
			        tools:[{
							iconCls:'icon-reload',
							border:false,
							handler:function(){
								refreshTab();
							}
						}
			        ]
			    });
				
				$('#menu').sidemenu({
		        	border:false
		           ,data: data
		           ,collapsed: true
		           ,width:60
		           ,onSelect:function(item){
		        	   if(item.url){
		        		   addTab(item.text,item.url);
		        	   }
		           }
		        });
			});
			function addTab(title,url){
				var content = '<iframe scrolling="auto" frameborder="0"  src="'+url +'" style="width:100%;height:100%;"></iframe>';
				
				if(!$('#tabs').tabs('exists',title)){
					$('#tabs').tabs('add',{
					    title:title,
					    content:content,
					    fit:true,
					    closable:true,
					    collapsible:true
					});
				}else{
					$('#tabs').tabs('select',title);
					refreshTab();
				}
				
			}
			function refreshTab(){
				var tab = $('#tabs').tabs('getSelected');
				if(tab!=null){
					$('#tabs').tabs('update', {
						tab: tab,
						options: {}
					});
				}
			}
			function collapsedMenu(){
				var opts = $('#menu').sidemenu('options');
		        $('#menu').sidemenu(opts.collapsed ? 'expand' : 'collapse');
		        opts = $('#menu').sidemenu('options');
		        $('#menu').sidemenu('resize', {
		            width: opts.collapsed ? 60 : 200
		        });
		        var content_wrap_width = $("#content_wrap").parent().width();
		        if(opts.collapsed){
		        	 $("#menu_wrap").panel("resize",{width:62});
		        	 $("#content_wrap").panel("move",{left:62});
		        	 $("#content_wrap").panel("resize",{width:content_wrap_width+140});
		        }else{
		        	 $("#menu_wrap").panel("resize",{width:202});
		        	 $("#content_wrap").panel("move",{left:202});
		        	 $("#content_wrap").panel("resize",{width:content_wrap_width-140});
		        }
			}
			
			function logout(){
				ServiceUnit.execute("sso/SSOService","logout",[],function(reslut){
    				sessionStorage.removeItem("token");
    				location.href = "./login";
    			});
			}
    	</script>
	</head>
	
	<body class="easyui-layout" data-options="fit:true">
		<div class="smart-header" data-options="region:'north',border:false">
			<img src="/static/img/logo.png" alt="" />
			<div style="float: right;">
				<a href="#" class="easyui-menubutton" data-options="iconCls:'icon-email'">消息</a>
				<a href="#" class="easyui-menubutton" data-options="iconCls:'icon-man'">设置</a>
				<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-control-power',plain:true" onclick="logout()">退出</a>
			</div>
		</div>
		<div id="menu_wrap" style="width:62px;" data-options="region:'west',border:true">
			<div id="menu"></div>
			<a href="#" class="easyui-linkbutton" onclick="collapsedMenu();" data-options="plain:true,iconCls:'icon-text-list-bullets'" style="width: 100%"></a>
		</div>
		<div id=content_wrap data-options="region:'center',border:true" >
			<div id ="tabs" class="easyui-tabs"></div>
		</div>
		
		<div  data-options="region:'south',border:true" style="text-align: center;height:20px;overflow:hidden;background:#e0ecff;">&copy;SmartMind All Rights Reserved</div>
	</body>
	
	<script type="text/javascript">
        var data = [{
            text: '系统',
            iconCls: 'icon-cog',
            state: 'open',
            children: [{
            	 iconCls: 'icon-book'
                ,text: '数据字典'
                ,url:'./sys/dataDictionary'
            },{
            	 iconCls: 'icon-link'
            	,text: '资源管理'
            	,url:'./sys/resource'
            },{
            	 iconCls: 'icon-user-group'
                ,text: '角色管理',
            },{
            	 iconCls: 'icon-user-key'
                ,text: '用户管理',
            }]
        },{
            text: '业务处理',
            iconCls: 'icon-package',
            children: [{
           	 iconCls: 'icon-page-white'
                 ,text: '订单管理'
                 ,url:'biz/order'
             },{
             	 iconCls: 'icon-page-white'
             	,text: '库存管理'
             	,url:'biz/stock'
             }]
        },{
            text: '工具',
            iconCls: 'icon-wrench-orange',
            children: [{
           	 iconCls: 'icon-chart-organisation'
                 ,text: 'eureka'
                 ,url:'http://127.0.0.1:8001/'
             },{
             	 iconCls: 'icon-node-tree16'
             	,text: 'zipkin'
             	,url:'http://127.0.0.1:9411/'
             },{
             	 iconCls: 'icon-clock-play'
                  	,text: 'xxl-job'
                  	,url:'http://127.0.0.1:8080/xxl-job-admin'
              },{
              	 iconCls: 'icon-database-go'
                   	,text: 'apollo'
                   	,url:'http://localhost:6003/'
               }]
        }];
        
    	/* var data = [];
	    var option = {
                "serviceName":"AuthorityService"
               ,"methodName":"getAcountResource"
               ,"params":[ServiceUnit.filter({order:{sort:1}})]
               ,"async":false
               ,"callback":function(result){
            	   data = result.data;
            	   for(var i=0;i<data.length;i++){
            		   var category = data[i];
            		   category = $.extend(category,JSON.parse(category.config));
            		   category.text = category.name
            		   if(category.children){
            			   for(var j=0;j<category.children.length;j++){
            				   var menu = category.children[j];
            				   menu = $.extend(menu,JSON.parse(menu.config));
            				   menu.text = menu.name;
            				    delete menu.children;
            				   menu.url+="?menuId="+menu.id;
            			   }
            		   }
            	   }
               }
           };
  		ServiceUnit.request(option); */
        
        
    </script>
</html>